/*$(document).ready(function() {

	setInterval(showTime, 1000);
	
})*/
//显示时间
function timer(obj, txt) {
	obj.text(txt);
}
function showTime() {
	var today = new Date();
	var weekday = new Array(7);
	weekday[0] = "星期一";
	weekday[1] = "星期二";
	weekday[2] = "星期三";
	weekday[3] = "星期四";
	weekday[4] = "星期五";
	weekday[5] = "星期六";
	weekday[6] = "星期日";
	var y = today.getFullYear();
	var month = today.getMonth();
	var td = today.getDate() ;
	var d = weekday[today.getDay()];
	var h = today.getHours();
	var m = today.getMinutes();
	var s = today.getSeconds();
		if(h<10){
		h = "0" + h;
		}
		if(m<10){
		m= "0" + m;
		}
		if(s<10){
		s= "0" + s;
		}
		$("#times").html(y +"年"+ month +"月"+ td+"日"+" " + d+" " + h +":"+ m+":" + s);
} 
//显示时间结束

function ajaxpages(nowpage,allpage,url){
	$("#page").append("<a class=\"ml10\" href=\"javascript:void(0)\" onclick=\"indexfrom("+nowpage+",1,'"+url+"')\">首页</a>");
	$("#page").append("<a class='ml10' href=\"javascript:void(0)\" onclick=\"beforfrom("+nowpage+",'"+url+"')\">上一页</a>");
	if(allpage<=8){
		for ( var int = 1; int <= allpage; int++) {
			if(int==nowpage){
				$("#page").append("<a style=\"color:#1691c5;\" class=\"schedule_current_page ml10\" id=\"a"+int+"\" href=\"javascript:void(0);\">"+int+"</a>");
			}else{
				$("#page").append("<a class=\"ml10\" id=\"a"+int+"\" href=\"javascript:void(0);\" onclick=\"updataaction("+int+",'"+url+"')\">"+int+"</a>");
			}
		}
	}else{
		for ( var int2 = 1; int2 <= 4; int2++) {
			if(int2==nowpage){
				$("#page").append("<a style=\"color:#515151;\" class=\"schedule_current_page ml10\" id=\"a"+int2+"\" href=\"javascript:void(0);\" >"+int2+"</a>");
				
			}else{
				$("#page").append("<a class=\"ml10\" id=\"a"+int2+"\" href=\"javascript:void(0);\" onclick=\"updataaction("+int2+",'"+url+"')\">"+int2+"</a>");
			}			
		}
		if(nowpage>4&&(nowpage<=allpage-4)){
			if(nowpage>5){
				$("#page").append("<span class=\"ml10\">"+"..."+"</span>");
				$("#page").append("<a class=\"ml10\" id=\"a"+(nowpage-1)+"\" href=\"javascript:void(0);\" onclick=\"updataaction("+(nowpage-1)+",'"+url+"')\">"+(nowpage-1)+"</a>");
			}
			$("#page").append("<a style=\"color:#515151;\" class=\"ml10 schedule_current_page\" id=\"a"+nowpage+"\" href=\"javascript:void(0);\" >"+nowpage+"</a>");
			if(nowpage!=(allpage-4)){
				$("#page").append("<a class=\"ml10\" id=\"a"+(nowpage+1)+"\" href=\"javascript:void(0);\" onclick=\"updataaction("+(nowpage+1)+",'"+url+"')\">"+(nowpage+1)+"</a>");
				$("#page").append("<span class=\"ml10\">"+"..."+"</span>");
			}			
		}
		else{
			$("#page").append("<span class=\"ml10\">"+"..."+"</span>");
		}		
		for ( var int3 = allpage-3; int3 <= allpage; int3++) {
			if(int3==nowpage){
				$("#page").append("<a style=\"color:#515151;\" class=\"ml10 schedule_current_page\" id=\"a"+(int3)+"\" href=\"javascript:void(0);\" >"+(int3)+"</a>");
			}else{
				$("#page").append("<a class=\"ml10\" id=\"a"+(int3)+"\" href=\"javascript:void(0);\" onclick=\"updataaction("+(int3)+",'"+url+"')\">"+(int3)+"</a>");
			}
		}
		//================
	}
	$("#page").append("<a class=\"ml10\" href=\"javascript:void(0)\" onclick=\"nextfrom("+nowpage+","+allpage+",'"+url+"')\">下一页</a>");
	$("#page").append("<a class=\"ml10\" href=\"javascript:void(0)\" onclick=\"indexfrom("+nowpage+","+allpage+",'"+url+"')\">末页</a>");
}

//上一页  form
function beforfrom(pagenumber,url){
	if(pagenumber==1){
	}else{
		$("#nowpager").val(pagenumber-1);
		ajaxQuery("#dataTable");
	}
}
//首页  末页
function indexfrom(nowpage,pagenumber,url){
if(nowpage==pagenumber){		
	}else{
	$("#nowpager").val(pagenumber);
	ajaxQuery("#dataTable");
	}
}
//下一页 form
function nextfrom(pagenumber,maxnumber,url){
	if(pagenumber==maxnumber){		
	}else{
		$("#nowpager").val(pagenumber+1);
		ajaxQuery("#dataTable");
	}
}
function updataaction(number,url){
	$("#nowpager").val(number);
	ajaxQuery("#dataTable");
} 
//分页结束

//ifram自适应高度
function iFrameHeight() {
	var ifm= document.getElementById("iframepage");
	var subWeb = document.frames ? document.frames["iframepage"].document : ifm.contentDocument;
	if(ifm != null && subWeb != null) {
		ifm.height = subWeb.body.scrollHeight;
	}
}
